package com.happyfamily.springboot.crowdsourcingplatform.service.weng.impl;

import com.happyfamily.springboot.crowdsourcingplatform.base.result.Results;
import com.happyfamily.springboot.crowdsourcingplatform.dao.weng.BackStationFlowDao;
import com.happyfamily.springboot.crowdsourcingplatform.model.BankAccount;
import com.happyfamily.springboot.crowdsourcingplatform.model.StationFlow;
import com.happyfamily.springboot.crowdsourcingplatform.service.weng.BackStationFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class BackStationFlowServiceImpl implements BackStationFlowService
{
	@Autowired
	BackStationFlowDao backStationFlowDao;


	@Override
	public Results<StationFlow> getAllStationFlowByPage(Integer startPosition, Integer limit)
	{
		return Results.success(backStationFlowDao.countAllStationFlow().intValue(), backStationFlowDao.getAllStationFlowByPage(startPosition, limit));
	}

	@Override
	public int deleteStationFlow(long sid)
	{
		return backStationFlowDao.deleteStationFlow(sid);
	}

	@Override
	public Results<StationFlow> getFlowByFuzzy(String stype, String startTime, String endTime, Integer startPosition, Integer limit)
	{
		return Results.success(backStationFlowDao.getFlowByFuzzy(stype, startTime, endTime).intValue(), backStationFlowDao.getFlowByFuzzyPage(stype, startTime, endTime, startPosition, limit));
	}

	@Override
	public Results<BankAccount> getBankPage(Integer startPosition, Integer limit)
	{
		return Results.success(backStationFlowDao.getBankCount().intValue(), backStationFlowDao.getBankPage(startPosition, limit));
	}
}
